﻿using MediatR;
using SystemHYS.API.Application.command.GualitySchemeCommmand;
using SystemHYS.Infrstructre.Interface;
namespace SystemHYS.API.Application.commandler.GualitySchemeCommandler
{
    public class GualitySchemeDeleteCommmandler:IRequestHandler<GualitySchemeDeleteCommmand,int>
    {
        IGualitySchemeRepository Repository;
        public GualitySchemeDeleteCommmandler(IGualitySchemeRepository repository)
        {
            this.Repository = repository;
        }

        public async Task<int> Handle(GualitySchemeDeleteCommmand request, CancellationToken cancellationToken)
        {
            var list = await Repository.GetModelAsnc(request.gualitySchemeId);
            list.IsDel = true;
            list.DelectTime = DateTime.Now.ToUniversalTime();
            list.DelectName = "李明";
            return await Repository.UpdateAsyn(list);
        }
    }
}
